﻿using System;
using System.Data;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;


namespace ColorApplication
{

    public class HTTPModule : IHttpModule, System.Web.SessionState.IRequiresSessionState
    {

        public void Init(HttpApplication app)
        {
            // register for pipeline events
            app.BeginRequest += new EventHandler(this.OnBeginRequest);
            app.PreRequestHandlerExecute += new EventHandler(this.OnPreRequestHandlerExecute);
        }

        private void OnPreRequestHandlerExecute(object sender, EventArgs e)
        {
        }

        public void Dispose() { }

        public void OnBeginRequest(object o, EventArgs args)
        {
            //// get access to app and context
            //string redirectURL = "";
            //System.Web.HttpApplication app = (System.Web.HttpApplication)o;
            //System.Web.HttpContext ctx = app.Context;

            //string[] domainParts = app.Context.Request.Url.Host.Split(".".ToCharArray());
            //if (domainParts[0].ToLower() != "www")
            //{
            //    redirectURL =  app.Context.Request.Url.ToString().Replace(app.Context.Request.Url.Host, "www.colorsay.com");
            //    app.Context.Response.Redirect(redirectURL);
            //}
        }

    }
}
